﻿@using Telerik.Web.Mvc.UI
@model IEnumerable<HotelMgr.Models.Employee>

@{
    ViewBag.Title = "Index";
}
<style type="text/css">
    .DataTime{ width: 80px;}
</style>
<h2 style="text-align: center;font-size: 20px;font-weight: bolder;">员工管理</h2>

<p style="font-size: 18px;font-weight: bolder;">
    @Html.ActionLink("添加职员", "Create")
</p>
@(Html.Telerik().Grid(Model)
.Name("employeeGrid")
.DataKeys(key=>key.Add(k=>k.EmployeeID))
.ToolBar(c=>c.Insert().ButtonType(GridButtonType.Image))
.DataBinding(b=>b.Server()
    .Select("Select","EmployeeManager")
    .Insert("Insert","EmployeeManager")
    .Update("Save","EmployeeManager")
    .Delete("Delete","EmployeeManager")
)
.Columns(e=>
             {
                 e.Bound(p => p.EmployeeNumber);
                 e.Bound(p => p.Name);
                 e.Bound(p => p.IDCard);
                 e.Bound(p => p.HireDate);
                 e.Bound(p => p.Sex);
                 e.Bound(p => p.Phone);
                 e.Bound(p => p.Birthday);
                 e.Bound(p => p.Age);
                 e.Bound(p => p.DismissalDate);
                 e.Bound(p => p.Address);
                 @*e.Template(@<text>
                                 @Html.ActionLink("修改", "Edit", new {id = item.EmployeeID}, null) |
                                 @Html.ActionLink("详细", "Details", new {id = item.EmployeeID}, null) |
                                 @Html.ActionLink("删除", "Delete", new {id = item.EmployeeID}, null)
                             </text>).Title("操作");*@
                 e.Command(c =>
                               {
                                   c.Edit().ButtonType(GridButtonType.Image);
                                   c.Delete().ButtonType(GridButtonType.Image);
                               });
             })
             .Editable(e=>e.Mode(GridEditMode.InLine))
             .Pageable()
             .Scrollable(s=>s.Enabled(true))
             .Footer(true))
